"""
MyCat数据库连接模块
# datetime.datetime = datetime.datetime('%Y-%m-%d %H:%M:%S')
"""
import pymysql


# 定义db方法
def db():
    try:
        # 打开数据库连接
        mycat_db = pymysql.connect(host='10.27.223.120',
                                   port=8066,
                                   user='selffabu',
                                   password='123456',
                                   db='PLSADM',
                                   charset='utf8')
        return mycat_db

    except pymysql.err.OperationalError as e:
        print("Mysql Error %d: %s" % (e.args[0], e.args[1]))


if __name__ == '__main__':
    db()
